import QtQuick 2.0
import "../../js/UI.js" as Style

Rectangle{
    width: m_root_id.width*0.4
    height: m_root_id.height*0.096
    color:"transparent"
    id: rct
    property bool btnEnable: false
    property alias m_text: m_Text.text
    property alias m_Text: m_Text
    signal canvasClicked(var canvasClickedCode)
    Canvas{
        id: myCanvas
        visible:mouse.pressed && !btnEnable
        width: parent.width
        height: parent.height
        onPaint: {
            var tempRound = myCanvas.height*0.2-5//半径
            var ctx = getContext("2d");
            ctx.lineWidth = 1;
            ctx.beginPath();
            ctx.moveTo(0,0)
            ctx.lineTo(myCanvas.width, 0)
            ctx.lineTo(myCanvas.width, myCanvas.height)
            ctx.lineTo(myCanvas.height*0.4, myCanvas.height)//圆起始点
            //圆心x，圆心Y，半径，方向，方向，顺逆时针
            ctx.arc(tempRound,myCanvas.height-tempRound,tempRound,0.5*Math.PI,Math.PI,false);
            ctx.lineTo(0,0)
            ctx.fillStyle = Style.mousePressedColor
            ctx.fill();
        }
    }
    Canvas{
        id: myCanvasTwo
        visible:mouse.pressed && btnEnable
        width: parent.width
        height: parent.height
        onPaint: {
            var tempRound = myCanvasTwo.height*0.2-5//半径
            var ctx = getContext("2d");
            ctx.lineWidth = 1;
            ctx.beginPath();
            ctx.moveTo(0,0)
            ctx.lineTo(myCanvasTwo.width, 0)
            ctx.lineTo(myCanvasTwo.width, myCanvasTwo.height*0.4)
            //圆心x，圆心Y，半径，方向，方向，顺逆时针
            ctx.arc(myCanvasTwo.width-tempRound,myCanvasTwo.height-tempRound,tempRound,0,0.5*Math.PI,false);
            ctx.lineTo(0, myCanvasTwo.height)//圆起始点
            ctx.lineTo(0,0)
            ctx.fillStyle = Style.mousePressedColor
            ctx.fill();
        }
    }
    AText{
        id:m_Text
        anchors.centerIn: parent
        color: Style.titlePontColor
        font.pointSize: Style.fontContentSize
    }
    MouseArea{
        id:mouse
        anchors.fill: parent;
        onClicked: {
            canvasClicked(1)
        }
    }
}


